/************************************************************
 * Copyright (C), 2022-2030, ripnano. Co., Ltd.
 * FileName:        form_setting_rtc.h
 * Author:          Dan Yin
 * Date:            2023-06-21
 * Description:     the class of datetime setting window
 * Version:         1.0.0.0
 **********************************************************/

#ifndef FORM_SETTING_RTC_H
#define FORM_SETTING_RTC_H

// add necessary includes here
#include "ui/defines/global.h"

namespace Ui {
class FormSettingRTC;
}

class FormSettingRTC : public QWidget
{
    Q_OBJECT

public:
    // Get an instance of "FormSettingRTC" class, if exist, return it
    static FormSettingRTC* getInstance(QWidget *pParent = nullptr);

signals:
    // The signal that refresh UI info
    void signalRefreshUI();

private slots:
    // The slot that refresh UI info
    void slotRefreshUI();

    // Save configuration info
    void on_pushButton_Save_clicked();

    void on_pushButton_Year_Plus_clicked();

    void on_pushButton_Year_Sub_clicked();

    void on_pushButton_Month_Plus_clicked();

    void on_pushButton_Month_Sub_clicked();

    void on_pushButton_Day_Plus_clicked();

    void on_pushButton_Day_Sub_clicked();

    void on_pushButton_Hour_Plus_clicked();

    void on_pushButton_Hour_Sub_clicked();

    void on_pushButton_Minute_Plus_clicked();

    void on_pushButton_Minute_Sub_clicked();

    void on_pushButton_Second_Plus_clicked();

    void on_pushButton_Second_Sub_clicked();

protected:
    // Triggers an event before it is switch language
    void changeEvent(QEvent *event);

private:
    // The default constructor
    explicit FormSettingRTC(QWidget *parent = nullptr);

    // The default destructor
    virtual ~FormSettingRTC();

    // After constructing object, initialize the object
    void _initialze();

    // Init the window style
    void _initUi();

    // Check the validity of the date
    void _checkSpecialDate();

    // Check the validity of the date
    bool _checkValidDate(QString sDate);

private:
    Ui::FormSettingRTC *ui;
};

#endif // FORM_SETTING_RTC_H
